<template>
  <div>


    </div>
</template>

<script>
import { getMenus } from "../api/api";
import {fn} from '@/utils/routeList.js'; //生成列表结构路由方法
export default {
  data() {
    return {
      leftSide: [],
      isCollapse:false,
    };
  },
  created () {
    this.getSide();
  },
  methods: {
    async getSide() {
      let res = await getMenus();
      console.log(res, "res");
      this.leftSide=res.data
      localStorage.setItem("menuList",JSON.stringify(res.data))

           //传进去树状路由表-调用递归方法返回列表结构
          let newArr=fn(res.data)
          console.log('路由列表结构1',newArr);
          newArr.forEach(item=>{
              this.$router.addRoute('HomeView',item)
          })
    },
  },
};
</script>

<style scoped>

</style>